package br.com.statizo.financeiro.view;


public class CalendarListComposite {

//	@Autowired
//	private CalendarService calendarService;
//	
//	@Autowired
//	public CalendarListComposite(TabFolder initFolder) {
//		super(initFolder, SWT.NONE);
//	}
//
//	@Override
//	public void createContents() {
//		setLayout(new FormLayout());
//		
//		FormData formData = new FormData();
//		formData.top = new FormAttachment(0,0);
//		formData.bottom = new FormAttachment(100,0);		
//		formData.left = new FormAttachment(0,0);		
//		formData.right = new FormAttachment(100,0);
//
//		Group calendarGroup = new Group(this,SWT.NONE);
//		calendarGroup.setText("Selecione um mês");
//		calendarGroup.setLayoutData(formData);
//		calendarGroup.setLayout(new FormLayout());
//
//		final List calendarList = new List(calendarGroup,SWT.BORDER);
//		calendarList.setItems(calendarService.getMonthNames());
//		calendarList.setSelection( calendarService.getSelectedMonth() + 1);
//
//		calendarList.addSelectionListener(new SelectionAdapter() {
//
//			@Override
//			public void widgetSelected(SelectionEvent e) {
//
//				int selected = calendarList.getSelectionIndex();
//				int last = calendarList.getItemCount() - 1;
//				int prevLast =  calendarList.getItemCount() - 2;
//
//				if(selected == 0)
//					calendarService.setPreviousYear();
//				else if(selected == prevLast)
//					calendarService.setNextYear();
//				else if(selected == last)
//					calendarService.setCurrentYear();
//				else 
//					calendarService.setSelectedMonth(selected);
//
//
//				if(selected == 0 || selected == last || selected == prevLast){
//
//					calendarList.removeAll();
//					calendarList.setItems(calendarService.getMonthNames());
//
//					if(selected == last){
//						calendarService.setCurrentMonth();
//					}else{
//						calendarService.setSelectedMonth(1);
//					}
//
//					calendarList.setSelection(calendarService.getSelectedMonth() + 1);
//
//				}
//
//
//			}
//
//
//		});
//
//
//
//		formData = new FormData();
//		formData.top = new FormAttachment(2,0);
//		formData.bottom = new FormAttachment(98,0);		
//		formData.left = new FormAttachment(2,0);		
//		formData.right = new FormAttachment(98,0);
//
//		calendarList.setLayoutData(formData);
//		
//		formData = new FormData();
//		formData.top = new FormAttachment(8,0);
//		formData.bottom = new FormAttachment(90,0);		
//		formData.left = new FormAttachment(3,0);		
//		formData.right = new FormAttachment(20,0);
//		this.setLayoutData(formData);
//		
//
//		
//	}
//	

}

